@{  
    Layout = "~/Views/Shared/_LayoutJtable.cshtml";      
}

@{ViewBag.Title = " DUA_Region ";}
<div class="filtering"><form>
<label>Introduzca texto para filtrar: <input type="text" name="filter" id="filter" /></label>
<button type="submit" id="LoadRecordsButton" class="button medium orange" >Buscar Coincidencias</button>
</form></div>
<div id="MyTableContainer"></div>
<script type="text/javascript">
     $(document).ready(function () {
     $('#MyTableContainer').jtable({
         title: 'DUA_Region',
         paging: true,
         pageSize: 40,
         sorting: true,
         defaultSorting: 'Id ASC',
         actions: {
             listAction: '@Url.Action("JSONPagedListByFilter")',
             deleteAction: '@Url.Action("JSONDelete")',
             updateAction: '@Url.Action("JSONUpdate")',
             createAction: '@Url.Action("JSONCreate")'
         },
         fields:
         {
          Id: {
                 key: true,
                 create: false,
                 edit: false,
                 list: false
             }
             ,
             Guid: {
                 type: 'hidden'
             }
             ,
             Codigo: {
                 title:'Codigo',
                 create: true,
                 edit: true,
                 list: true,
                 inputClass: 'validate[required]',
                 sorting: false
             }
             ,
             Nombre: {
                 title:'Nombre',
                 create: true,
                 edit: true,
                 list: true,
                 inputClass: 'validate[required]',
                 sorting: false
             }
             ,
             Abreviacion: {
                 title:'Abreviacion',
                 create: true,
                 edit: true,
                 list: true,
                 sorting: false
             }
             ,
             Latitud: {
                 title:'Latitud',
                 create: true,
                 edit: true,
                 list: true,
                 inputClass: 'validate[required]',
                 sorting: false
             }
             ,
             Longitud: {
                 title:'Longitud',
                 create: true,
                 edit: true,
                 list: true,
                 inputClass: 'validate[required]',
                 sorting: false
             }
             ,
             CodTelefono: {
                 title:'CodTelefono',
                 create: true,
                 edit: true,
                 list: true,
                 sorting: false
             }
             ,
             RegionPadreId_FK:{
                 title : 'DUA_Region',
                 create : true,
                 edit : true,
                 list : true,
                 options : '@Url.Action("../Region/JSONGetElementsForDropDownList")'
             }
},
formCreated: function (event, data) {data.form.validationEngine();},
formSubmitting: function (event, data) {return data.form.validationEngine('validate');},
formClosed: function (event, data) { data.form.validationEngine('hide'); data.form.validationEngine('detach'); }
});
$('#LoadRecordsButton').click(function (e) {e.preventDefault();$('#MyTableContainer').jtable('load', {filter: $('#filter').val()});});
$('#LoadRecordsButton').click();
});
</script>

